package com.moto.controller.user;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.moto.entity.Bolg;
import com.moto.interceptor.BaseContext;
import com.moto.result.Result;
import com.moto.service.IFavoriteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zy
 * @since 2023-08-31
 */

@RestController
@RequestMapping("/moto/User/bolg")
@Slf4j
@CrossOrigin("*")
@Api(tags = "用户收藏和浏览记录相关接口")
public class FavoriteController {

    @Autowired
    private IFavoriteService favoriteService;

    @GetMapping("/favorite")
    @ApiOperation(value = "收藏列表")
    public Result<List<Bolg>> favoriteList(){
        log.info("收藏列表");
        int id = Math.toIntExact(BaseContext.getCurrentId());
        List<Bolg> list = favoriteService.favoriteList(id);
        list.forEach(s-> System.out.println(s));
        return Result.success(list);
    }





}
